$().ready(function(){
    var search = window.location.search;
    search = search.slice(1);
    var nav = search.split('=')[1];
    // console.log(nav);
    // var navList;
    // switch (nav) {
    //     case '0': navList = alasunList
    //        break;
    //     case '1':navList = newsCenter
    //         break;
    //     case '2':navList = productLayout
    //         break;
    //     case '3':navList = socialResponsibility
    //         break;
    //     case '4':navList = expertTeam
    //         break;
    // }
    let navList;
    for(let i in mainList){
        if(nav == mainList[i].id){
            // console.log(mainList[i]);
            navList = mainList[i];
        }
    }
    var navHtml = '';
    var navTitle = '<a href="index.html">首页</a>';
        navTitle += '<a href="nav-page.html?nav='+nav+'">'+navList.name+'</a>';
    $('#breadcream').html(navTitle);
    for(var i in navList.list){
        navHtml += '<div class="nav-item-box"><div class="nav-items">';
        navHtml += '<a href="'+navList.list[i].link+'?nav='+navList.id+'&item='+navList.list[i].id+'">';
        navHtml += '<div class="item-content">';
        navHtml += '<p class="title-cn">'+navList.list[i].name+'</p>';
        navHtml += '<p class="title-en">'+navList.list[i].en+'</p>';
        navHtml += ' </div><img src="img/arrow.png" alt=""> </a></div></div>'
    }
    $('#navList').html(navHtml);
})
